class fenwick():
    def __init__(self, t):
        self.s = [0] * (len(t)+1) # Internal Storage
        for a, v in enumerate(t):
            self.add(a, v)        # Initialize

    def prefixSum(self, a):
        i = a + 1
        total = 0
        while i > 0:
            total += self.s[i]
            i -= (i & -i)
        return total

    def rangeSum(self, a, b):
        return self.prefixSum(b) - self.prefixSum(a-1)

    def add(self, a, val):
        i = a + 1
        while i < len(self.s):
            self.s[i] += val
            i += (i & -i)

    def rangeAdd(self, a, b, val):
        self.add(a,   +val)
        self.add(b+1, -val)

    def get(self, a):
        return self.prefixSum(a)

if __name__ == '__main__':
    n, q = map(int, input().strip().split(' '))
    x = [0] + list(map(int, input().strip().split(' ')))
    ft = fenwick(x)
    for _ in range(q):
        t, a, b = map(int, input().strip().split(' '))
        if t == 1:
            ft.add(a, b-x[a])
            x[a] = b
        else:
            print(ft.rangeSum(a, b))
